// import com.alibaba.druid.DbType;
// import com.alibaba.druid.sql.ast.SQLExpr*;
// import com.alibaba.druid.sql.ast.SQLObject_ptr ;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;

// import java.util.ArrayList;
// import java.util.std::list;

#include "SQLPrivilegeStatement.h"

#include "../SQLExpr.h"
#include "../SQLObject.h"
#include "SQLObjectType.h"
#include "SQLPrivilegeItem.h"

SQLPrivilegeStatement::SQLPrivilegeStatement()
{
  resourceType = NULL;
  privileges = std::make_shared<std::list<SQLPrivilegeItem_ptr>>();
  users = std::make_shared<std::list<SQLExpr_ptr>>();
}

SQLPrivilegeStatement::SQLPrivilegeStatement(DbType_ptr  dbType)
    : SQLStatementImpl(dbType)
{
  resourceType = NULL;
  privileges = std::make_shared<std::list<SQLPrivilegeItem_ptr>>();
  users = std::make_shared<std::list<SQLExpr_ptr>>();
}

SQLExpr_list_ptr  SQLPrivilegeStatement::getUsers()
{
  return users;
}

void SQLPrivilegeStatement::addUser(SQLExpr_ptr user)
{
  if (user == NULL)
  {
    return;
  }
  user->setParent(SharedObject(SQLPrivilegeStatement));
  this->users->push_back(user);
}

void SQLPrivilegeStatement::setUsers(SQLExpr_list_ptr  users)
{
  this->users = users;
}

SQLObject_ptr SQLPrivilegeStatement::getResource()
{
  return resource;
}

void SQLPrivilegeStatement::setResource(SQLObject_ptr x)
{
  if (x != NULL)
  {
    x->setParent(SharedObject(SQLPrivilegeStatement));
  }

  this->resource = x;
}

void SQLPrivilegeStatement::setResource(SQLExpr_ptr resource)
{
  if (resource != NULL)
  {
    resource->setParent(SharedObject(SQLPrivilegeStatement));
  }
  this->resource = resource;
}

SQLPrivilegeItem_list_ptr SQLPrivilegeStatement::getPrivileges()
{
  return privileges;
}

SQLObjectType_ptr SQLPrivilegeStatement::getResourceType()
{
  return resourceType;
}

void SQLPrivilegeStatement::setResourceType(SQLObjectType_ptr x)
{
  this->resourceType = x;
}
